Skip to content

Added purge gas as a multivariable output#760

Merged
johnjasa merged 3 commits into
NatLabRockies:developfrom
johnjasa:add_purge_gas_multivariable
May 21, 2026
Merged

Added purge gas as a multivariable output#760
johnjasa merged 3 commits into
NatLabRockies:developfrom
johnjasa:add_purge_gas_multivariable

Conversation

@johnjasa
Copy link
Copy Markdown
Collaborator

@johnjasa johnjasa commented May 19, 2026

Expose synloop purge gas as process_gas_mixture multivariable stream

Adds a process_gas_mixture multivariable stream definition and uses it to expose the ammonia synloop purge gas as a structured output with mass flow, composition (hydrogen, nitrogen, ammonia, argon mass fractions), temperature, and pressure. The hydrogen_out and nitrogen_out outputs now represent only unused feedstock, separating them from the purge gas stream.

Section 1: Type of Contribution

  • Feature Enhancement
    • Framework
    • New Model
    • Updated Model
    • Tools/Utilities
    • Other (please describe):
  • Bug Fix
  • Documentation Update
  • CI Changes
  • Other (please describe):

Section 2: Draft PR Checklist

  • Open draft PR
  • Describe the feature that will be added
  • Fill out TODO list steps
  • Describe requested feedback from reviewers on draft PR
  • Complete Section 7: New Model Checklist (if applicable)

TODO:

  • Define process_gas_mixture stream in commodity_stream_definitions.py
  • Update AmmoniaSynLoopPerformanceModel to output purge gas via the new stream
  • Add tests for stream definition and purge gas outputs
  • Add documentation section to ammonia.md

Type of Reviewer Feedback Requested (on Draft PR)

Structural feedback: Is process_gas_mixture the right name/scope for this stream definition?

Implementation feedback: Are the 7 stream variables (mass_flow, 4 mass fractions, temperature, pressure) sufficient?

Other feedback: N/A

Section 3: General PR Checklist

  • PR description thoroughly describes the new feature, bug fix, etc.
  • Added tests for new functionality or bug fixes
  • Tests pass (If not, and this is expected, please elaborate in the Section 6: Test Results)
  • Documentation
    • Docstrings are up-to-date
    • Related docs/ files are up-to-date, or added when necessary
    • Documentation has been rebuilt successfully
    • Examples have been updated (if applicable)
  • CHANGELOG.md
    • At least one complete sentence has been provided to describe the changes made in this PR
    • After the above, a hyperlink has been provided to the PR using the following format:
      "A complete thought. [PR XYZ]((https://github.com/NatLabRockies/H2Integrate/pull/XYZ)", where
      XYZ should be replaced with the actual number.

Section 4: Related Issues

Resolves #754

Section 5: Impacted Areas of the Software

Section 5.1: New Files

None.

Section 5.2: Modified Files

  • h2integrate/core/commodity_stream_definitions.py
    • Added process_gas_mixture stream definition with 7 variables (mass_flow, hydrogen, nitrogen, ammonia, argon mass fractions, temperature, pressure).
  • h2integrate/converters/ammonia/ammonia_synloop.py
    • Added add_multivariable_output call in setup() and purge gas stream population in compute(). Separated purge gas from unused feedstock outputs.
  • h2integrate/converters/ammonia/test/test_ammonia_synloop_model.py
    • Added subtests verifying purge gas stream output shape, value ranges, and mass fraction correctness.
  • h2integrate/core/test/test_commodity_stream_definitions.py
    • Added test_add_process_gas_mixture_output and test_add_process_gas_mixture_input.

Section 6: Additional Supporting Information

Purge gas molar fractions (hydrogen, nitrogen, ammonia, argon) are converted to mass fractions using all four species' molecular weights. The process_gas_mixture stream type is generic and can be reused by other components.

Section 7: Test Results, if applicable

  • test_ammonia_synloop_model.py: 4 passed, 47 subtests passed
  • test_commodity_stream_definitions.py: 6 passed, 18 subtests passed

@johnjasa johnjasa requested a review from elenya-grant May 19, 2026 14:46
Copy link
Copy Markdown
Collaborator

@elenya-grant elenya-grant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks great! Thanks for adding this in! Awesome to see another use of multi-variable commodity output streams!

@johnjasa johnjasa marked this pull request as ready for review May 21, 2026 19:30
@johnjasa johnjasa enabled auto-merge (squash) May 21, 2026 19:31
@johnjasa johnjasa merged commit 24e2f27 into NatLabRockies:develop May 21, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants